<template>
  <div>
    <Header :currentCity="currentCity" :cityList="cityList"></Header>
    <Crumb :crumbListData="crumbListData"></Crumb>
    <div class="loupan-content">
      <div class="sitemap-center">
        <br />
        <div class="sitemap-label"><span>快速查找&nbsp;&nbsp;&nbsp;&nbsp;</span></div>
        <div class="sitemap-row">
          <dl class="row-dl">
            <dt class="row-dt">分类：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a :href="`${prefixUrl}/lpcx/`" target="_blank">新房</a>
              </div>
              <div class="after-inline">
                <a v-for="item in letter" :key="item" :href="`${prefixUrl}/loupan/${item}`" :title="item" target="_blank" style="margin-right: 15px;">{{item}}</a>
              </div>
            </dd>
          </dl>
          <dl class="row-dl">
            <dt class="row-dt">{{currentCity.cityName}}找房：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a :href="`${prefixUrl}/wyzf/`" title="我要找房" target="_blank">我要找房</a>
              </div>
            </dd>
          </dl>
        </div>
        <div class="sitemap-label"><span>新房&nbsp;&nbsp;&nbsp;&nbsp;</span></div>
        <div class="sitemap-row">
          <dl class="row-dl" v-if="metroList.length > 0">
            <dt class="row-dt">{{currentCity.cityName}}地铁：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in metroList" :key="index" :href="item.href" :title="item.lineName" target="_blank">{{item.lineName}}</a>
              </div>
            </dd>
          </dl>
          <dl class="row-dl">
            <dt class="row-dt">{{currentCity.cityName}}街区：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in regionList" :key="index" :href="item.href" v-show="item.id" :title="item.shortName" @mouseover="regionListIndex=index" :class="regionListIndex==index?'on':''" target="_blank">{{item.name}}</a>
              </div>
              <div class="after-inline">
                <a v-for="item,index in regionList[regionListIndex].streetList" :key="index" :href="item.href" :title="item.shortName" target="_blank">{{item.shortName}}楼盘</a>
              </div>
            </dd>
          </dl>
          <dl class="row-dl">
            <dt class="row-dt">单价：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in priceList" :key="index" :href="item.href" :title="item.name" target="_blank">{{item.name}}</a>
              </div>
            </dd>
          </dl>
          <dl class="row-dl">
            <dt class="row-dt">总价：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in priceTotalList" :key="index" :href="item.href" :title="item.name" target="_blank">{{item.name}}</a>
              </div>
            </dd>
          </dl>
          <dl class="row-dl">
            <dt class="row-dt">户型：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in houseTypeList" :key="index" :href="item.href" :title="item.name" target="_blank">{{item.name}}</a>
              </div>
            </dd>
          </dl>
          <dl class="row-dl">
            <dt class="row-dt">面积：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in areaList" :key="index" :href="item.href" :title="item.name" target="_blank">{{item.name}}</a>
              </div>
            </dd>
          </dl>
          <dl class="row-dl">
            <dt class="row-dt">销售状态：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in saleStateList" :key="index" :href="item.href" :title="item.name" target="_blank">{{item.name}}</a>
              </div>
            </dd>
          </dl>
          <dl class="row-dl">
            <dt class="row-dt">物业类型：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in propertyTypeList" :key="index" :href="item.href" :title="item.name" target="_blank">{{item.name}}</a>
              </div>
            </dd>
          </dl>
          <dl class="row-dl">
            <dt class="row-dt">开盘时间：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in openingTimeList" :key="index" :href="item.href" :title="item.name" target="_blank">{{item.name}}</a>
              </div>
            </dd>
          </dl>
          <dl class="row-dl">
            <dt class="row-dt">装修状况：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in renovationList" :key="index" :href="item.href" :title="item.name" target="_blank">{{item.name}}</a>
              </div>
            </dd>
          </dl>
        </div>
        <div class="sitemap-label"><span>优惠楼盘&nbsp;&nbsp;&nbsp;&nbsp;</span></div>
        <div class="sitemap-row">
          <dl class="row-dl">
            <dt class="row-dt">{{currentCity.cityName}}街区：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in regionList" :key="index" :href="`${item.href}-m1`" v-show="item.id" :title="item.shortName" @mouseover="regionListIndex2=index" :class="regionListIndex2==index?'on':''" target="_blank">{{item.name}}</a>
              </div>
              <div class="after-inline">
                <a v-for="item,index in regionList[regionListIndex2].streetList" :key="index" :href="`${item.href}-m1`" :title="item.shortName" target="_blank">{{item.shortName}}优惠楼盘</a>
              </div>
            </dd>
          </dl>
        </div>
        <div class="sitemap-label"><span>楼盘热搜&nbsp;&nbsp;&nbsp;&nbsp;</span></div>
        <div class="sitemap-row">
          <dl class="row-dl">
            <dt class="row-dt">{{currentCity.cityName}}楼盘：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in searchLabelList" :key="index" :href="item.href" :title="item.name" target="_blank">{{item.name}}</a>
              </div>
            </dd>
          </dl>
        </div>
        <div class="sitemap-label"><span>资讯&nbsp;&nbsp;&nbsp;&nbsp;</span></div>
        <div class="sitemap-row">
          <dl class="row-dl">
            <dt class="row-dt">楼盘资讯：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in newsTypeData" :key="index" :href="item.href" :title="item.name" target="_blank">{{item.name}}</a>
              </div>
            </dd>
          </dl>
        </div>
        <div class="sitemap-label"><span>资讯聚合&nbsp;&nbsp;&nbsp;&nbsp;</span></div>
        <div class="sitemap-row">
          <dl class="row-dl">
            <dt class="row-dt">分类/标签：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in newsTypeData" :key="index" :href="item.href" :title="item.name" @mouseover="newsTypeDataAttr=item.attr" :class="newsTypeDataAttr==item.attr?'on':''" target="_blank">{{item.name}}</a>
              </div>
              <div class="after-inline">
                <a v-for="item,index in queryNewsTagNamesData[newsTypeDataAttr]" :key="index" :href="`${prefixUrl}/lpzxjh/${item}/`" :title="item" target="_blank">{{item}}</a>
              </div>
            </dd>
          </dl>
        </div>
        <div class="sitemap-label"><span>推荐聚合&nbsp;&nbsp;&nbsp;&nbsp;</span></div>
        <div class="sitemap-row">
          <dl class="row-dl">
            <dt class="row-dt">标签：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in juheData" :key="index" :href="`${prefixUrl}/lpzxjh/${item}/`" :title="item" target="_blank">{{item}}</a>
              </div>
            </dd>
          </dl>
        </div>
        <div class="sitemap-label"><span>问答&nbsp;&nbsp;&nbsp;&nbsp;</span></div>
        <div class="sitemap-row">
          <dl class="row-dl">
            <dt class="row-dt">类型：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in labsData" :key="index" :href="item.href" :title="item.name" target="_blank">{{item.name}}</a>
              </div>
            </dd>
          </dl>
        </div>
        <div class="sitemap-label"><span>优质房源&nbsp;&nbsp;&nbsp;&nbsp;</span></div>
        <div class="sitemap-row">
          <dl class="row-dl">
            <dt class="row-dt">分类：&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a v-for="item,index in yzfyTabs" :key="index" :href="item.href" :title="item.name" target="_blank">{{item.name}}</a>
              </div>
            </dd>
          </dl>
        </div>
        <div class="sitemap-label"><span>更多&nbsp;&nbsp;&nbsp;&nbsp;</span></div>
        <div class="sitemap-row">
          <dl class="row-dl">
            <dt class="row-dt">&nbsp;</dt>
            <dd class="row-dd">
              <div class="before-inline">
                <a :href="`${prefixUrl}/dtzf/`" :title="`${currentCity.cityName}地图找房`" target="_blank">{{currentCity.cityName}}地图找房</a>
                <a :href="`${prefixUrl}/mfzc/`" title="专车看房" target="_blank">专车看房</a>
                <a href="https://mfgjw.com" title="周边城市" target="_blank">周边城市</a>
              </div>
            </dd>
          </dl>
        </div>
      </div>
    </div>
    <Footer :currentCity="currentCity"></Footer>
  </div>
</template>

<script>
import u from "@/plugins/Ccom";
var head = {
  title: "",
  content: "",
  keywords: "",
};
export default {
  head() {
    return {
      title: head.title,
      meta: [
        { name: "keywords", content: head.keywords },
        { name: "description", content: head.content },
      ],
    };
  },
  async asyncData(ctx) {
    var prefixUrl = ctx.prefixUrl;
    var currentCity = ctx.currentCity;
    var cityList = ctx.cityList;
    var regionList = ctx.regionList;
    var metroList = [] // 地铁数据
    var houseTypeList = [] // 户型数据
    var priceList = [] // 单价数据
    var priceTotalList = [] // 总价数据
    var areaList = [] // 面积数据
    var saleStateList = [] // 销售状态数据
    var propertyTypeList = [] // 物业类型数据
    var renovationList = [] // 装修状况数据
    var openingTimeList = [] // 开盘时间数据
    var newsTypeData = [{
      href: `${prefixUrl}/lpzx/hyxw`,
      name: '行业新闻',
      attr: 'hyNew'
    }, {
      href: `${prefixUrl}/lpzx/lpdt`,
      name: '楼盘动态',
      attr: 'dtNew'
    }, {
      href: `${prefixUrl}/lpzx/lpbk`,
      name: '楼盘百科',
      attr: 'bkNew'
    }, {
      href: `${prefixUrl}/lpzx/rmtj`,
      name: '热门推荐',
      attr: 'rmNew'
    }]
    var queryNewsTagNamesData = null
    var labsData = []
    var yzfyTabs = [{
      href: `${prefixUrl}/yzfy/9583311.html`,
      name: '教育地产'
    }, {
      href: `${prefixUrl}/yzfy/9583312.html`,
      name: '景观地产'
    }, {
      href: `${prefixUrl}/yzfy/9583313.html`,
      name: '现房'
    }, {
      href: `${prefixUrl}/yzfy/9583314.html`,
      name: '地铁房'
    }, {
      href: `${prefixUrl}/yzfy/9583315.html`,
      name: '小户型'
    }, {
      href: `${prefixUrl}/yzfy/9583316.html`,
      name: '品牌地产'
    }]
    var crumbListData = [{
      title: `${currentCity.cityName}✖✖✖✖✖✖✖✖✖✖`,
      href: prefixUrl,
    }, {
      title: '网站地图',
      href: '',
    }]
    var searchLabelList = [{
      name: '万科',
      href: `${prefixUrl}/lpcx/o1`,
    }, {
      name: '返现',
      href: `${prefixUrl}/lpcx/o2`,
    }, {
      name: '交通便利',
      href: `${prefixUrl}/lpcx/o3`,
    }, {
      name: '免费专车',
      href: `${prefixUrl}/lpcx/o4`,
    }, {
      name: '学区房',
      href: `${prefixUrl}/lpcx/o5`,
    }, {
      name: '融创',
      href: `${prefixUrl}/lpcx/o6`,
    }, {
      name: '医院',
      href: `${prefixUrl}/lpcx/o7`,
    }]
    var juheData = []
    
    // 获取地铁
    var getMetro = await u.http({
      url: '/app/metro/queryMetroInfoByCityId',
      params: {
        cityId: ctx.cityCode,
      },
    })
    if (getMetro.code == 200) {
      getMetro.data.forEach((item) => {
        item.href = `${prefixUrl}/lpcx/${item.aliases}`
      })
      metroList = getMetro.data
    }
    // 设置区域街道跳转路径
    regionList.forEach(item => {
      if (item.id) {
        item.href = `${prefixUrl}/lpcx/${item.aliases}`
        item.streetList.forEach(ite => {
          ite.href = `${prefixUrl}/lpcx/${item.aliases}-${ite.aliases}`
        })
      }
    })
    // 获取户型
    var getHouseType = await u.http({
      url: '/app/cfg/queryCfgDataByCmid',
      params: {
        cmId: 410,
      },
    })
    if (getHouseType.code == 200) {
      houseTypeList = getHouseType.data
      houseTypeList.forEach((item) => {
        item.href = `${prefixUrl}/lpcx/${item.aliases}`
      })
    }
    // 获取单价
    var getUnitPrice = await u.http({
      url: '/app/cfg/queryCfgDataByCmid',
      params: {
        cmId: 409,
      },
    })
    if (getUnitPrice.code == 200) {
      priceList = getUnitPrice.data
      priceList.forEach((item) => {
        item.href = `${prefixUrl}/lpcx/${item.aliases}`
      })
    }
    // 获取总价
    var getTotalPrice = await u.http({
      url: '/app/cfg/queryCfgDataByCmid',
      params: {
        cmId: 408,
      },
    })
    if (getTotalPrice.code == 200) {
      getTotalPrice.data.forEach((item) => {
        item.href = `${prefixUrl}/lpcx/${item.aliases}`
      })
      priceTotalList = getTotalPrice.data
    }
    // 获取面积
    var getArea = await u.http({
      url: '/app/cfg/queryCfgDataByCmid',
      params: {
        cmId: 413,
      },
    })
    if (getArea.code == 200) {
      getArea.data.forEach((item) => {
        item.href = `${prefixUrl}/lpcx/${item.aliases}`
      })
      areaList = getArea.data
    }
    // 获取销售状态
    var getSalesStatus = await u.http({
      url: '/app/cfg/queryCfgDataByCmid',
      params: {
        cmId: 421,
      },
    })
    if (getSalesStatus.code == 200) {
      getSalesStatus.data.forEach((item) => {
        item.href = `${prefixUrl}/lpcx/${item.aliases}`
      })
      saleStateList = getSalesStatus.data
    }
    // 获取物业类型
    var getPropertyType = await u.http({
      url: '/app/cfg/queryCfgDataByCmid',
      params: {
        cmId: 414,
      },
    })
    if (getPropertyType.code == 200) {
      getPropertyType.data.forEach((item) => {
        item.href = `${prefixUrl}/lpcx/${item.aliases}`
      })
      propertyTypeList = getPropertyType.data
    }
    // 获取装修状况
    var getDecorationStatus = await u.http({
      url: '/app/cfg/queryCfgDataByCmid',
      params: {
        cmId: 412,
      },
    })
    if (getDecorationStatus.code == 200) {
      getDecorationStatus.data.forEach((item) => {
        item.href = `${prefixUrl}/lpcx/${item.aliases}`
      })
      renovationList = getDecorationStatus.data
    }
    // 获取开盘时间
    var getOpeningTime = await u.http({
      url: '/app/cfg/queryCfgDataByCmid',
      params: {
        cmId: 419,
      },
    })
    if (getOpeningTime.code == 200) {
      getOpeningTime.data.forEach((item) => {
        item.href = `${prefixUrl}/lpcx/${item.aliases}`
      })
      openingTimeList = getOpeningTime.data
    }
    // 获取资讯 标签
    let getQueryNewsTagNames = await u.http({
      url: '/app/new/queryNewsTagNames',
      params: {
        cityCode: ctx.cityCode
      }
    })
    if (getQueryNewsTagNames.code == 200) {
      queryNewsTagNamesData = getQueryNewsTagNames.data
    }
    // 获取标签列表
    var getLabsData = await u.http({
      url: '/app/cfg/queryCfgDataByCmid',
      params: {
        cmId: 423,
      },
    })
    if (getLabsData.code == 200) {
      getLabsData.data.forEach((item, index) => {
        item.href = `${prefixUrl}/nwwd/${item.aliases}`
        labsData.push(item)
      })
    }
    // 新闻聚合
    let getJuheData = await u.http({
      url: '/pc/new/queryNewTagList',
      params: {
        cityCode: ctx.cityCode
      }
    })
    if (getJuheData.code == 200) {
      juheData = getJuheData.data
    }

    // 修改TDK
    head.title = `${currentCity.cityName}✖✖✖✖✖✖✖✖✖✖网站地图`;
    head.content = `${currentCity.cityName}✖✖✖✖✖✖✖✖✖✖网站地图`;
    head.keywords = `${currentCity.cityName}✖✖✖✖✖✖✖✖✖✖网站地图`;
    return {
      prefixUrl,
      currentCity,
      cityList,
      crumbListData,
      letter: ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],
      metroList,
      regionList,
      houseTypeList,
      priceList,
      priceTotalList,
      areaList,
      saleStateList,
      propertyTypeList,
      renovationList,
      openingTimeList,
      newsTypeData,
      queryNewsTagNamesData,
      labsData,
      yzfyTabs,
      searchLabelList,
      juheData,
    };
  },
  data() {
    return {
      regionListIndex: 1,
      regionListIndex2: 1,
      newsTypeDataAttr: 'hyNew',
    }
  }
};
</script>